<template>
  <div class="page-content padding-top">
    <item @click.native="selectItem()">不限车型</item>
    <item v-for="item in arr" @click.native="selectItem(item.modelId,item.modelName)">{{item.modelName}}</item>
  </div>
</template>
<script>
import { bus } from 'bus.js'
 // ...

  export default {
    data() {
      return {
        arr:[],
        seriesId:null,
        brandJson:{}
      }
    },
    created(){
      bus.$on('toModel', (obj) => {
        this.arr = [];
        this.brandJson = obj;
        var _this = this;
        axios.get(baseUrl+'/controller/getModelList',{params:{
            seriesId:obj.seriesId
          }
        })
        .then(function(res){
          _this.arr = res.data.result;
        })
      });
    },
    methods: {
      selectItem(a,b){
        if(a){
          this.brandJson.modelId = a;
          this.brandJson.modelName = b;
          bus.$emit('brandJson',this.brandJson);
        }else{
          bus.$emit('brandJson',this.brandJson);
        }
        
      }
    }
  }
</script>

